<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    /* 
      https://leetcode-cn.com/problems/lian-biao-zhong-dao-shu-di-kge-jie-dian-lcof/
      思路：https://leetcode-cn.com/problems/lian-biao-zhong-dao-shu-di-kge-jie-dian-lcof/solution/yi-ci-xun-huan-ji-ke-by-wanyuxuan/
     */
    function getKthFromEnd(head, k) {
      let fast = head, slow = head
      let i = 0
      while (fast) {
        if (i >= k) {
          slow = slow.next
        }
        fast = fast.next
        i++
      }
      return slow
    }
  </script>
</body>
</html>